<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/printer/printer.js"></script>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<br>' +
            '<ol class="breadcrumb">' +

            '<li>' +
            '<a>打印机</a>' +
            '</li>' +
            '<li>' +
            '<strong>打印机</strong>' +
            '</li>' +
            '</ol>';
    });

    var has_add = 'hidden';
    var has_edit = 'hidden';
</script>

<shiro:hasPermission name="system:printer:add">
    <script type="text/javascript">
        has_add = '';
    </script>
</shiro:hasPermission>
<shiro:hasPermission name="system:printer:edit">
    <script type="text/javascript">
        has_edit = '';
    </script>
</shiro:hasPermission>


<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <div class="fixed-table-toolbar">
                    <div class="columns pull-left">
                        <shiro:hasPermission name="system:printer:add">
                            <button type="button" class="btn btn-success" onclick="printer.add()">
                                <i class="fa fa-plus" aria-hidden="true"></i>增加打印机
                            </button>
                        </shiro:hasPermission>
                    </div>
                    <%--<shiro:hasPermission name="system:printer:export">--%>
                        <%--<div class="pull-right search col-md-2">--%>
                            <%--<button type="button" class="btn btn-success" onclick="printer.exportFile()">导出</button>--%>
                        <%--</div>--%>
                        <%--<div class="pull-right search col-md-1 ">--%>
                            <%--<input id="printSize" type="text" class="form-control"--%>
                                   <%--placeholder="导出条数" width="100px" max="99999" maxlength="5" onkeyup="value=value.replace(/[^\d]/g,'')">--%>
                        <%--</div>--%>
                    <%--</shiro:hasPermission>--%>
                    <div class="pull-right search col-md-2">
                        <button class="btn btn-success" onclick="printer.reLoad()">查询</button>
                    </div>
                    <div class="pull-right search col-md-2 nopadding">
                        <input id="priRtua" type="text" class="form-control"
                               placeholder="打印机逻辑地址" autocomplete="off" maxlength="11" minlength="11"
                               onkeyup="this.value =this.value.replace(/\s/g,'').replace(/[^\d]/g,'').replace(/(\d{2})(?=\d)/g,'$1 ');">
                    </div>
                    <div class="pull-right search col-md-1">
                        <select id="priStatus" name="priStatus" class="form-control" placeholder="打印机状态">
                            <option value="" selected="selected">打印机状态</option>
                            <option value="1"> 正常</option>
                            <option value="2"> 缺纸</option>
                            <option value="3"> 故障</option>
                        </select>
                    </div>
                    <div class="pull-right search col-md-2">
                        <select id="id" name="id" class="form-control" placeholder="桩群名称">
                            <option value="" selected="selected">桩群名称</option>
                            <c:forEach items="${pileGroups}" var="bean">
                                <option value="${bean.id}">${bean.stationName}(${bean.addressDetail})
                                </option>
                            </c:forEach>
                        </select>
                    </div>
                    <%--<div class="pull-right search col-md-2">
                        <input id="stationName" type="text" class="form-control"
                               placeholder="桩群名">
                    </div>--%>
                </div>
                <div class="fixed-table-toolbar">

                    <shiro:hasPermission name="system:printer:export">
                        <div class="pull-right search col-md-2">
                            <button type="button" class="btn btn-success exportBtn" onclick="printer.exportFile()">导出</button>
                        </div>
                        <div class="pull-right search col-md-1 ">
                            <input id="printSize" type="text" class="form-control"
                                   placeholder="导出条数" width="100px" max="99999" maxlength="5" onkeyup="value=value.replace(/[^\d]/g,'')">
                        </div>
                    </shiro:hasPermission>
                </div>
                <table id="exampleTable" data-mobile-responsive="true">
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    printer.init();
</script>
<%--<script>--%>
    <%--$(function () {--%>
        <%--$('#priRtua').on('keyup', function (e) {--%>
            <%--//只对输入数字时进行处理--%>
            <%--if ((e.which >= 48 && e.which <= 57) ||--%>
                <%--(e.which >= 96 && e.which <= 105)) {--%>
                <%--//获取当前光标的位置--%>
                <%--var caret = this.selectionStart--%>
                <%--//获取当前的value--%>
                <%--var value = this.value--%>
                <%--//从左边沿到坐标之间的空格数--%>
                <%--var sp = (value.slice(0, caret).match(/\s/g) || []).length--%>
                <%--//去掉所有空格--%>
                <%--var nospace = value.replace(/\s/g, '')--%>
                <%--//重新插入空格--%>
                <%--var curVal = this.value = nospace.replace(/(\d{2})/g, "$1 ").trim()--%>
                <%--//从左边沿到原坐标之间的空格数--%>
                <%--var curSp = (curVal.slice(0, caret).match(/\s/g) || []).length--%>
                <%--//修正光标位置--%>
                <%--this.selectionEnd = this.selectionStart = caret + curSp - sp--%>
            <%--}--%>
        <%--})--%>
    <%--})--%>
<%--</script>--%>
</body>
</html>
